﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="msg_outbox_list.aspx.cs" Inherits="Ccit.SysPlat.Remind.msg_outbox_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.1" Namespace="DevExpress.Web.ASPxGridView"
    TagPrefix="dxwgv" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>在线消息-已发送消息</title>
    <script language="javascript" src="../script/jquery.js" type="text/javascript"></script>
    <script language="javascript" src="../script/StringClass_Ext.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jsonlib.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="../script/jbase64.js"></script>
    
    <script type="text/javascript" language="javascript">
    
      /* 查询 */
      function GetFuzzy()
      {
          __doPostBack("lnkSearch","");
      }
      
      /* 单个重发*/
      function doForward(vMsgId)
      {
          PageMethods.OperMsg(vMsgId,"","","Forword",ClientCallBack);
      }
      
      /* 批量重发*/
      function doLotReSend()
      {
         var vMsgIds = document.getElementById("hdIds").value;
         if(vMsgIds == "")
         { 
            alert("请选择要重发的信息");
            return ;
         }
         PageMethods.OperMsg(vMsgIds,"","","ReSend",ClientCallBack);
      }
      
      /*查看消息*/
      function doViewMsg(vMsgId,vReceiverId,vCurCount)
      {
         PageMethods.OperMsg(vMsgId,vReceiverId,vCurCount,"ViewMsg",ClientCallBack);
      }
      
      /* 删除 */
      function doDelete()
      { 
        var vMsgIds = document.getElementById("hdIds").value;
        
        if(vMsgIds == "")
        {
            alert("请选择要删除的消息！");
            return;
        }
        else
        {
            if(confirm("确认要删除选择的消息？"))
                PageMethods.OperMsg(vMsgIds,"","","DELETE",ClientCallBack);
        }
      }
      
      /* 折叠*/
      function doCollapse()
      {
         var tabCtrl = document.getElementById("tabQuery");
         var tabAttr = tabCtrl.style.display;
         if(tabAttr == "none")
           tabCtrl.style.display = "block";
         else
           tabCtrl.style.display = "none";
      }
      
      function ClientCallBack(vResult) {
         if(vResult == null || vResult == "") return;
         
         eval("var resultObj=" + vResult);
         var operType = resultObj.operType;
//         var vResultArr = vResult.split("_");
//         var vFlag = vResultArr[0];
         switch(operType)
         {
            case "ViewMsg" :
                var msgId = resultObj.msgId;
                var receiverId = resultObj.receiverId;
                var curCount = resultObj.curCount;
                var vPageParam = "MsgId="+msgId+"&receiverId="+receiverId+"&curCount="+curCount+"&PageSource=2";                
                var encodeParam = base64encode(vPageParam);                
                OpenWindow("msg_receive_view.aspx?"+encodeParam,"","500","380");
                break;
            case "ReSend" :
                var flag = resultObj.flag;
                if(flag > 0)
                {
                    alert("发送成功");
                    document.location = "msg_outbox_list.aspx";
                }
                else
                {
                    alert("系统忙,请稍候再试");
                }
                break;
            case "Delete" :
                var flag = resultObj.flag;
                if(flag > 0)
                {
                    alert("删除成功");
                    document.location = "msg_outbox_list.aspx";
                }
                else
                {
                    alert("系统忙,请稍候再试");
                }
                break;
            case "Forword" : 
                var msgId = resultObj.msgId;
                var vPageParam = "MsgId="+msgId+"&PageSource=2";
                var encodeParam = base64encode(vPageParam);
                OpenWindow("msg_send_edit.aspx?"+encodeParam,"","700","600");
                break;
          }
      }
     
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">
      
       <input type="hidden" id="hdIds" runat="server" />
       <input type="hidden" id="_hidReceiverId" runat="server" />
      
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        </asp:ScriptManager>
        <asp:LinkButton ID="lnkSearch" runat="server" Visible="false" ></asp:LinkButton>
        <table cellpadding="0" cellspacing="0" class="tbToolbar" width="98%" align="center">
          <tr>
            <td align="left">
              <div class="tbSeparator"></div>
            </td>
            <td width="95%" class="titlebar">在线消息-已发送消息</td>
            <td width="5%">
                <a href="javascript:doCollapse()" class="linktext" title="折叠"><img src="../images/hidemenu.gif"/></a>
            </td>
            <td align="right">
              <div class="tbSeparator"></div>
            </td>
          </tr>
        </table>
       
        <table id="tabQuery" cellpadding="0" runat="server" cellspacing="0" align="center" width="98%"  height="5px" style="margin-top:3px">
         <tr>
           <td>
              <fieldset style="width:100%">
                 <table cellpadding="0" cellspacing="0" width="100%" align="center" height="3px" >
                  <tr>
                    <td style="width:40%">
                       <nobr>
                          内容 <input type="text" runat="server"  class="input" id="txtContent"  style="width:100px"/>
                       </nobr> 
                    </td>
                    <td  style="width:13%">
                      <nobr>
                        收件人 <input type="text" runat="server" id="txtReceiver"  class="input"  style="width:100px"/>
                      </nobr>
                    </td>
                    <td  style="width:3%">
                      &nbsp;
                    </td>
                    <td  style="width:13%">
                       <nobr>
                        发送时间 <input type="text" runat="server" id="txtBeginTime"  class="input"  style="width:90px"  readonly/>
                        <IMG class="getdate" id="IMG1" title="选择日期" src="../images/toolbar/Calendar.gif" relaobj="txtBeginTime">
                       </nobr>
                    </td>
                    <td  style="width:13%">
                      <nobr>
                         到 <input type="text" runat="server" id="txtEndTime"  class="input"   style="width:90px"  readonly/>
                        <IMG class="getdate" id="IMG2" title="选择日期" src="../images/toolbar/Calendar.gif" relaobj="txtEndTime">
                      </nobr>  
                    </td>
                    <td  style="width:5%">
                       <nobr>
                          <a href="javascript:GetFuzzy()" title="查询" class="linktext">
                                <img src="../images/toolbar/search.gif" />
                            </a>
                        </nobr>
                    </td>
                  </tr>
                 </table>
              </fieldset>
           </td>
         </tr>
        </table>
        
        
        <table cellpadding="0" cellspacing="0" align="center" width="98%"  height="5px" style="margin-top:3px;">
          <tr>
            <td style="width:6%">
             <nobr>
              图例:
             </nobr> 
            </td>
            <td style="width:78%" align="left">
              <nobr>
                <img src="../images/toolbar/turn.GIF" />转发&nbsp;
                <img src="../images/toolbar/lcgl_wjtz.gif" />重发&nbsp;
                <img src="../images/toolbar/delete.gif" />删除
              </nobr>
            </td>
            <td style="width:5%" align="center">
              <nobr>
                 <a href="javascript:doLotReSend()" class="linktext" title="重发"><img src="../images/toolbar/lcgl_wjtz.gif" /></a>
              </nobr>  
            </td>
            <td style="width:5%" align="center">
               <nobr>
                  <a href="javascript:doDelete()" class="linktext" title="删除"><img src="../images/toolbar/delete.gif" /></a>
                </nobr>
            </td>
          </tr>
        </table>
        
        
        <table cellpadding="0" cellspacing="0" width="98%" border="0" align="center" valign="top" style="margin-top:3px;">
          <tr>
            <td>
              <dxwgv:ASPxGridView ID="gvSendMsg" Width="100%" 
                                        AutoGenerateColumns="False"                                         
                                        Settings-ShowFooter="false"
                                        runat="server" KeyFieldName="MsgId" onhtmlrowcreated="gvSendMsg_HtmlRowCreated">
                <Columns>
                    <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="3%">
                        <HeaderTemplate>
                            <input id="chkCheck" class="checkbox" type="checkbox" runat="server" onclick="gvSendMsg.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Select/Unselect all rows on the page"></input>
                        </HeaderTemplate>
                        <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" HorizontalAlign="Center">
                            <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                        </HeaderStyle>
                    </dxwgv:GridViewCommandColumn>
                    <dxwgv:GridViewDataTextColumn Caption="内容" FieldName="MsgContent" VisibleIndex="1" Width="60%">
                        <HeaderStyle HorizontalAlign="Center"/>
                        <CellStyle HorizontalAlign="left" Wrap="False" ></CellStyle>
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn Caption="收件人" FieldName="ReceiverIds" VisibleIndex="3" Width="12%">
                        <HeaderStyle HorizontalAlign="Center"/>
                        <CellStyle HorizontalAlign="Center" Wrap="False"></CellStyle>
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn Caption="发送时间" FieldName="SendTime" VisibleIndex="4" Width="17%">
                        <HeaderStyle HorizontalAlign="Center" />
                        <CellStyle HorizontalAlign="Center"></CellStyle>
                    </dxwgv:GridViewDataTextColumn>
                    
                    <dxwgv:GridViewDataTextColumn Caption="操作" VisibleIndex="5" Width="6%">
                        <HeaderStyle HorizontalAlign="Center" />
                        <CellStyle HorizontalAlign="Center" Wrap="False"></CellStyle>
                        <DataItemTemplate>
                            <a id="haForward" runat="server" title="转发"><img src="../images/toolbar/turn.GIF" /></a>
                        </DataItemTemplate>
                    </dxwgv:GridViewDataTextColumn>
                    
                    <dxwgv:GridViewDataTextColumn Caption="当前个数" FieldName="CurCount" Visible="false">
                        <HeaderStyle HorizontalAlign="Center" />
                        <CellStyle HorizontalAlign="Center" Wrap="False"></CellStyle>
                    </dxwgv:GridViewDataTextColumn>
                   
                </Columns>
                <SettingsPager AlwaysShowPager="True" PageSize="10">
                    <FirstPageButton Visible="True">
                    </FirstPageButton>
                    <LastPageButton Visible="True">
                    </LastPageButton>
                </SettingsPager>
                <Styles>
                    <Row CssClass=""></Row>
                    <AlternatingRow  CssClass="" Enabled="true"/>
                    <SelectedRow  CssClass=""></SelectedRow>
                </Styles>
                <%-- 复选框选择脚本事件 --%>
                <ClientSideEvents SelectionChanged="function(s,e){OnGridSelectionChanged();}"/>
                 <%-- 可调整列宽--%>
                <SettingsBehavior ColumnResizeMode="Control" />
               </dxwgv:ASPxGridView>
            </td>
          </tr>
        </table>
        <script language="javascript" type="text/javascript">
            <!--
            /* 复选框选择 */
            function OnGridSelectionChanged(){
                gvSendMsg.GetSelectedFieldValues("MsgId",OnGridSelectionComplete);
            }
            
            function OnGridSelectionComplete(values){
                document.getElementById("hdIds").value = values;
            }
            
            //-->
        </script>
    </ccit:ActionForm>
</body>
</html>
